package com.example.computerstroe.controller;

import com.example.computerstroe.entity.User;
import com.example.computerstroe.service.IUserService;
import com.example.computerstroe.service.ex.InsertException;
import com.example.computerstroe.service.ex.ServiceException;
import com.example.computerstroe.service.ex.UserNameDuplicationException;
import com.example.computerstroe.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("user")
public class UserController extends BaseController{
    @Autowired
    private IUserService UserService;

    @RequestMapping(value = "/addUser")
    public Result<Void> addUser(User user){
        Result<Void>result=new Result<>(ok);
        UserService.insert(user);
        return result;
    }
}
